package com.ccc.boot.pojo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 树形结构基础封装类
 *
 * @author superC
 * @version 0.1.0
 * @date 2022/4/8
 */

public class BaseTree implements Serializable {

    private static final long serialVersionUID = -2753439455407924128L;

    /**
     * 菜单主键ID
     */
    private Long id;

    /**
     * 父ID
     */
    private Long pid;

    /**
     * 是否有子集（true 有； false 无）
     */
    private Boolean hasChildren;

    /**
     * 子集合
     */
    List<BaseTree> children = new ArrayList<>();

    /**
     * 添加子集
     * @param node
     */
    public void add(BaseTree node){
        children.add(node);
    }

    /*  ********* getter/setter *********** */

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }

    public Boolean getHasChildren() {
        return hasChildren;
    }

    public void setHasChildren(Boolean hasChildren) {
        this.hasChildren = hasChildren;
    }

    public List<BaseTree> getChildren() {
        return children;
    }

    public void setChildren(List<BaseTree> children) {
        this.children = children;
    }
}